import axios from 'axios'
import { defineStore } from 'pinia'
import { ref } from 'vue'

export const usechannelsStore = defineStore('channels', () => {
    //声明数据state
    const channelsList = ref([])
    //声明数据方法
    const getList = async () => {
         //处理异步操作
        const { data: { data } } = await axios.get('http://geek.itheima.net/v1_0/channels')
        channelsList.value = data.channels
        // console.log(data.channels );
    }
    return {
        channelsList,
        getList
    }
})